#pragma once
#include <list>
#include <stdint.h>
#include "base/core/point2.h"
#include "base/core/double_list.h"
#include "Common/CharacterDefine.h"

class Creature;

class Grid
{
	typedef DoubleList CidLst;
protected:
	CidLst m_cidLst;   //区域内的玩家cid
	uint32_t size;
	Point2<uint32_t> m_gridPos;
public:
	uint32_t GetSize() const { return size; }
	void AddCreature(Creature* pCreature);
	void RemoveCreature(Creature* pCreature);
	void RemoveCid(CharIDType cid);
	CidLst& GetCids() { return m_cidLst; }
	void UnInit();
	void SetGridPos(Point2<uint32_t> gridPos) { m_gridPos = gridPos; }
	bool IsSame(Point2<uint32_t> pos) { return pos == m_gridPos; }
	void RemoveNode(DoubleNode* pNode);

	Grid();
	~Grid();
};
